/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package javaapplication6.ControlLayer;

/**
 *
 * @author meydlo
 */
import javaapplication6.DomainLayer.RentRecords;
import javaapplication6.DomainLayer.RentProduct;
public class RentControl {

    private RentRecords rentRecords=RentRecords.getRentRecords();
    private long idOfProduct=0;

    //
    public RentProduct createRentProduct(String name, String description, int numOfOneType, double price,double discount)
    {

        idOfProduct=idOfProduct+1;
        RentProduct rentProduct=rentRecords.createRentProduct(idOfProduct,name, description, numOfOneType, price, discount);
        return rentProduct;
    }


    //
    public void deleteRentProduct(long id)
    {
        rentRecords.deleteRentProduct(id);
    }

    //
    public RentProduct findRentProduct(long id)
    {
        return rentRecords.rentProductByID(id);
    }

    //
    public void printRentProductInfo(long id)
    {
        try{
        rentRecords.rentProductByID(id).printProductInfo();
        }
        catch(Exception e){
            rentRecords.rentProductByID(id);
        }
    }

    public void printRentProductList()
    {
        rentRecords.printRentProductList();
    }

    public RentProduct getRentProductByName(String name)
    {
        RentProduct rentProduct=rentRecords.rentProductByName(name);
        return rentProduct;
    }

}
